export default (token) => {
    let temp = token

    const JwtUtil = {
        separate: () => {
            temp = token.split('.')
            return JwtUtil
        },
        base64ToJson: () => {
            temp.forEach((item, index) => {
                try {
                    temp[index] = JSON.parse(window.atob(item))
                } catch (ignored) {
                }
            })
            return JwtUtil
        },
        end: () => temp || null
    }

    return JwtUtil
}

